import AccountProfile from "@/components/forms/AccountProfile";
import { currentUser } from "@clerk/nextjs/server";

async function Page() {
  try {
    const user: any = await currentUser();

    const userInfo: any = null;

    const userData = {
      id: user?.id,
      objectId: userInfo?._id,
      username: userInfo ? userInfo?.username : user?.username,
      name: userInfo ? userInfo?.name : (user?.firstName ?? ""),
      bio: userInfo ? userInfo?.bio : "",
      image: userInfo ? userInfo?.image : user?.imageUrl,
    };

    return (
      <main className="mx-auto flex max-w-3xl flex-col justify-start px-5 py-5">
        <h1 className="head-text">Onboarding</h1>
        <p className="mt-3 text-base-regular text-light-2">
          Complete your profile now, to use Threads.
        </p>

        <section className="mt-9 bg-dark-2 p-5">
          <AccountProfile user={userData} btnTitle="Continue" />
        </section>
      </main>
    );
  } catch (e) {}
}

export default Page;
